﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Data.Common;
using DAL;
using Model;
using ServiceCenterApp.Helper;

namespace ServiceCenterApp
{
    static class Program
    {
        static MainWindow mainWindow;
        static FormError formError;
        public static MainWindow MainWindow { get { return mainWindow; } }

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (!AppHelper.Init())
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true;
            formError = new FormError();
            mainWindow = new ServiceCenterApp.MainWindow();
            WinformHelper.MainWindow = MainWindow;
            Application.Run(mainWindow);
        }

        public static void ShowError(Exception ex)
        {
            formError.Show(ex);
        }

        public static void ShowValidateInfo(string message)
        {
            MessageBox.Show(message, "数据验证错误！", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
    }
}
